# -*- coding = utf-8 -*-
# @TIME:2024/9/20 11:03
# @Author:月的第一话
# @File:dome2.py
# @Software:PyCharm
# from random import random
#
# for i in range(1,10+1,2):
#     print(i,end="\t")
# for i in range(1.100+1):
#     if i % 3 == 0:
#         print(i,end="\t")
#
# num=random().randint(1,100)
# while True:
#     guess=int(input("请输入一个数字:"))
#
#     if guess>num:
#         print("太大了")
#     elif guess<num:
#         print("太小了")
#     else:
#         print("猜对了")
#         break
# for i in range(1,100+1):
# #    if i % 7 ==0 or str(i).find('7')!=-1:
#     if i % 7 ==0 or str(i).count('7')>0:
#         print(i,end="\t")

#打印菱形
for i in range(1,11+1,2):
    print(("*"*i).center(11))
for i in range(9,0,-2):
    print(("*"*i).center(11))
#打印菱形2，多重嵌套
q=int(input("请输入到菱形中间的行数："))
for i in range(1,q,1):
    print(" "*(q-i)+"*"*(i+i-1))
for i in range(q,0,-1):
    print(" " *(q-i) + "*" * (i+i-1))
#水仙花数
q=int(input("请输入范围(最低):"))
w=int(input("请输入范围(最高):"))
for i in range(q,w+1,1):
    a=1
    n=0
    count=0
    o=i
    while(i//a!=0):
        a=a*10
        n=n+1
    if n>=3:
        num=list(str(i))
        for j in range(0,n):
            sum=int(num[j])**n



        if sum==i:
            count=count+1
            print("第%d个水仙花数是:%d"%(count,i))
print(count)
#打印100以内的质数
for i in range(1,100+1):
    count=0
    for j in range(2,i):
        if i%j==0:
            count=1
    if count==0:
        print(i)

#斐波那契数列
a=int(input("请输入数量："))
p=list(range(a))
if a==1:
    print("第1个数为1")
elif a==2:
    print("第1个数为1")
    print("第2个数为1")
else:
    p[0]=1
    p[1]=1
    print("第1个数为1")
    print("第2个数为1")
    for i in range(2,a):
        p[i]=int(p[i-1])+int(p[i-2])
        b=int(p[i])
        print("第%d个数为%d"%(i+1,b))
#九九乘法表
for i in range(1,10,1):
    for q in range(1,i+1,1):

        print("%d*%d=%d" %(i,q,i*q),end="\t")
    print("\n")
#打印100以内的完数
for i in range(1,100+1):
    count=0
    for j in range(1,i):
        if i%j==0:
            count=count+j
    if count==i:
        print(i)
        print("第%d个完数是:%d"%(i,i))

